package com.pac.user.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.pac.user.bean.UserBean;
import com.pac.user.dao.UserDao;

/**
 * 用户Dao实现
 * 
 * @author  lujun.chen
 * @version  [版本号, 2015年2月13日]
 * @see  [相关类/方法]
 * @since  [产品/模块版本]
 */
@Repository(value="userDao")
public class UserDaoImpl implements UserDao {
	
    @Autowired
    private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public List<UserBean> queryUser(UserBean userBean) {
		return sqlSessionTemplate.selectList("queryUser", userBean);
	}

	@Override
	public String addUser(UserBean userBean) {
		sqlSessionTemplate.insert("addUser", userBean);
		return userBean.getId();
	}

	@Override
	public boolean editUser(UserBean userBean) {
		int n=sqlSessionTemplate.update("editUser", userBean);
		return n>0;
	}

	@Override
	public boolean delUser(UserBean userBean) {
		int n=sqlSessionTemplate.delete("delUser", userBean);
		return n>0;
	}

}
